package com.yanqu.road.server.cmd.activity.tonbingchannel.channel;

import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.activity.ChannelTonBingProto;
import com.yanqu.road.server.cmd.base.AbstractCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.gameplayer.module.activity.tonbingchannel.ChannelTonBingModule;
import com.yanqu.road.server.manger.activity.tonbingchannel.ChannelTonBingMgr;
import com.yanqu.road.server.protocol.GameProtocol;

@Cmd(code = GameProtocol.S_CHANNEL_CTON_BING_SYNC_USER_DATA, desc = "跨服同步用户统兵演武数据")
public class TonBingSyncUserDataFromCrossCmd extends AbstractCommand {

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        return true;
    }

    @Override
    public void execute(GamePlayer player, YanQuMessage packet) throws Exception {
        ChannelTonBingProto.ChannelTonBingSyncUserDataMsg reqMsg = ChannelTonBingProto.ChannelTonBingSyncUserDataMsg.parseFrom(packet.getBytes());
        //存住资格证明
        ChannelTonBingMgr.addAbleUserId(packet.getPlayerId());

        if (player != null) {
            player.getModule(ChannelTonBingModule.class).updateUserData(reqMsg);
        }
    }

    @Override
    public void sendData(GamePlayer player) {

    }
}
